package by.kniazhych.core.controllers.actions {
	
	/**
	 * ...
	 * @author Boutylin Mikhail
	 */
	
		import by.kniazhych.core.controllers.AbstractServerAction;
	import by.kniazhych.core.controllers.GameController;
	import by.kniazhych.core.data.game.PeaceData;
	import by.kniazhych.core.data.game.PeacePosition;
	import by.kniazhych.core.events.GameEvent;
	

	
	public class ChangePeaceAction extends AbstractServerAction {
		
		private var _peaceType:uint;
		private var _position:PeacePosition;
		
		public function ChangePeaceAction(target:GameController, position:PeacePosition, peaceType:uint) {
			super(target);
			_position = position;
			_peaceType = peaceType;
		}
		
		override public function process():void {
			super.process();
			PeaceData(super._peaceLinker[_position.y + ":" + _position.x]).changePeaceType(_peaceType);
			dispatchEvent(new GameEvent(GameEvent.ACTION_PROCESSED));
		}
	}

}